import request from '@/axios';
import {baseUrl} from '@/config/env';

export const list = () => {
    return loadAll();
}
export const loadAll = () => {
    return request({
            url: baseUrl + '/start/sysDept/list',
            method: 'get',
        }
    )
}
export const add = (data) => {
    return request({
            url: baseUrl + '/start/sysDept/add',
            method: 'post',
            data: data
        }
    )
}

export const updateById = (data) => {
    return request({
            url: baseUrl + '/start/sysDept/updateById',
            method: 'put',
            data: data
        }
    )
}
export const deleteById = (id) => {
    return request({
            url: baseUrl + '/start/sysDept/deleteById/' + id,
            method: 'delete',
        }
    )
}
export const getAllDept = () => {
    return loadAll();
}
const deptApi = {
    list,
    loadAll,
    add,
    updateById,
    deleteById,
    getAllDept
}

export default deptApi
